//
//  MCUIToolkit.m
//  MClient
//
//  Created by Zhouyi on 10-8-31.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "MCUIToolkit.h"
#import "SBJSON.h"
#import "AListCell.h"
#import "MCImageView.h"
#import "ColorBackgroundView.h"
#import "QuartzCore/CAlayer.h"

@implementation MCUIToolkit

+ (NSMutableDictionary *)getField:(NSMutableDictionary *)appItem {
	if (appItem == nil) {
		return [[NSMutableDictionary alloc] init];
	}
	if ([appItem objectForKey:@"rfld"]) {
		return [appItem objectForKey:@"rfld"];
	}
	return [appItem objectForKey:@"fld"];
}

+ (NSString *)getFieldName:(NSMutableDictionary *)appItem {
	if (appItem == nil) {
		return @"";
	}
	NSString *name;
	NSMutableDictionary *field = [appItem objectForKey:@"fld"];
	if ([appItem objectForKey:@"rfld"]) {
		NSMutableDictionary *relField = [appItem objectForKey:@"rfld"];
		name = [NSString stringWithFormat:@"%@:%@",[field objectForKey:@"name"],[relField objectForKey:@"name"]];
	}else {
		name = [field objectForKey:@"name"];
	}
	return name == nil?@"":name;
}

+ (NSString *)getFieldType:(NSMutableDictionary *)appItem {
	if (appItem == nil) {
		return @"";
	}
	NSMutableDictionary *field;
	if ([appItem objectForKey:@"rfld"]) {
		field = [appItem objectForKey:@"rfld"];
	}else {
		field = [appItem objectForKey:@"fld"];
	}
	return [field objectForKey:@"type"] == nil?@"":[field objectForKey:@"type"];
}

+ (NSString *)getFieldLabel:(NSMutableDictionary *)appItem {
	if (appItem == nil) {
		return @"";
	}
	NSMutableDictionary *field;
	if ([appItem objectForKey:@"rfld"]) {
		field = [appItem objectForKey:@"rfld"];
	}else {
		field = [appItem objectForKey:@"fld"];
	}
	return [field objectForKey:@"lbl"] == nil?@"":[field objectForKey:@"lbl"];
}

+ (NSString *)getRelationObject:(NSMutableDictionary *)appItem {
	if (appItem == nil) {
		return @"";
	}
	NSMutableDictionary *field = [appItem objectForKey:@"fld"];
	return [field objectForKey:@"robj"] == nil?@"":[field objectForKey:@"robj"];
}

+ (NSMutableDictionary *)splitSelectItems2Dictionary:(NSMutableDictionary *)selectOption {
	NSMutableDictionary *pair = [[NSMutableDictionary alloc] init];
	if (selectOption == nil) {
		return [pair autorelease];
	}
	if (![selectOption objectForKey:@"list"]) {
		return [pair autorelease];
	}
	NSMutableArray *array = [selectOption objectForKey:@"list"];
	for (int i = 0; i < [array count]; i++) {
		NSMutableDictionary *option = [array objectAtIndex:i];
		if (![option objectForKey:@"v"]) {
			continue;
		}
		[pair setObject:[option objectForKey:@"t"] == nil?@"":[option objectForKey:@"t"] forKey:[option objectForKey:@"v"]];
		if ([option objectForKey:@"icon"]) {
			[pair setObject:[option objectForKey:@"icon"] forKey:[NSString stringWithFormat:@"icon_%@",[option objectForKey:@"v"]]];
		}
	}
	return [pair autorelease];
}

+ (NSString *)replaceMultItemLable:(NSString *)aString selectItems:(NSMutableDictionary *)selectItems {
	if (aString == @"" || aString == nil) {
		return @"";
	}
	NSArray *values = [aString componentsSeparatedByString:@","];
	NSString *label = @"";
	NSString *icons = @"";
	for(int i = 0; i < [values count]; i++) {
		NSString *tmp = [selectItems objectForKey:[values objectAtIndex:i]];
		if (tmp != nil){
			label = [[label stringByAppendingString:tmp] stringByAppendingString:@","];
			NSString *icon = [selectItems objectForKey:[NSString stringWithFormat:@"icon_%@",[values objectAtIndex:i]]];
			if (icon != nil) {
				icons = [[icons stringByAppendingString:icon] stringByAppendingString:@","];
			}
		}
	}
	if ([label length] > 0) {
		label = [label substringToIndex:[label length] - 1];
	}
	if ([icons length] > 0) {
		icons = [icons substringToIndex:[icons length] - 1];
		label = [NSString stringWithFormat:@"%@::%@", label, icons];
	}
	return [label retain];
}

+ (NSMutableDictionary *)getselectOption:(NSMutableDictionary *)appItem
							selectOption:(NSMutableDictionary *)so
							   fieldName:(NSString *)fieldName {
	NSMutableDictionary *selectOption;
	NSMutableDictionary *field = [self getField:appItem];
	if (so != nil) {
		selectOption = [so objectForKey:fieldName];
		if (selectOption == nil) {
			selectOption = [field objectForKey:@"so"];
		}
	} else {
		selectOption = [field objectForKey:@"so"];		
	}	
	return selectOption;
}

+ (NSMutableDictionary *)getselectItems:(NSMutableDictionary *)appItem
						   selectOption:(NSMutableDictionary *)so
							  fieldName:(NSString *)fieldName {
	NSMutableDictionary *selectOption = [self getselectOption:appItem
												 selectOption:so
													fieldName:fieldName];
	NSMutableDictionary *selectItems = [self splitSelectItems2Dictionary:selectOption];
	return selectItems;
}

+ (NSString *)convertValue:(NSMutableDictionary *)appItem
				 fieldData:(NSMutableDictionary *)fieldData
			  selectOption:(NSMutableDictionary *)so {
	NSString *fieldType = [self getFieldType:appItem];
	NSString *name = [self getFieldName:appItem];
	NSString *value = @"";
	char cFieldType;
	strncpy(&cFieldType, [fieldType UTF8String], 1);		
	switch (cFieldType) {
		case 'B': //复选框
		{
			if ([fieldData objectForKey:@"value"] == nil || [[fieldData objectForKey:@"value"] isEqualToString:@""]
				|| [[fieldData objectForKey:@"value"] isEqualToString:@"0"]) {
				value = @"";
			}else {
				value = @"☑";
			}
		}
			break;
			
		case 'H': //单选列表（下拉框）
		case 'I': //多选列表（列表框）
		case 'K': //单选列表（单选按钮）
		case 'L': //多选列表（复选框）
		{
			
			NSMutableDictionary *selectItems = [self getselectItems:appItem
													   selectOption:so
														  fieldName:name];
			if (so != nil) {
				NSMutableDictionary *selectOption = [so objectForKey:name];
				if (selectOption != nil) {
					NSString *keyValue = @"";
					NSMutableArray *array = [selectOption objectForKey:@"list"];
					for (int i = 0; i < [array count]; i++) {
						NSMutableDictionary *option = [array objectAtIndex:i];
						if ([[option objectForKey:@"s"] boolValue] == YES) {
							keyValue = [keyValue stringByAppendingFormat:@"%@,", [option objectForKey:@"v"] == nil?@"":[option objectForKey:@"v"]];
						}
					}
					if (![@"" isEqualToString:keyValue]) {
						keyValue = [keyValue substringToIndex:[keyValue length] - 1];
						[fieldData setObject:keyValue forKey:@"value"];
						value = [self replaceMultItemLable:keyValue selectItems:selectItems];
						[fieldData setObject:value forKey:@"lbl"];
					}
				}else {
					value = [self replaceMultItemLable:[fieldData objectForKey:@"value"] == nil?@"":[fieldData objectForKey:@"value"] selectItems:selectItems];
				}
			} else {
				value = [self replaceMultItemLable:[fieldData objectForKey:@"value"] == nil?@"":[fieldData objectForKey:@"value"] selectItems:selectItems];
			}
			if ([value length] == 0) {
				value = [fieldData objectForKey:@"value"] == nil?@"":[fieldData objectForKey:@"value"];
			}
		}
			break;
			
		case 'J': //文件
		case 'S': //图片
		case 'Y': //文件（多个）
		{
			NSMutableArray *fileInfos = [fieldData objectForKey:@"fi"];
			NSString *label = @"";
			if (fileInfos != nil) {
				if ([fileInfos count] > 1) {
					for (int i = 0; i<[fileInfos count]; i++) {
						NSMutableDictionary *fileInfo = [fileInfos objectAtIndex:i];
						if ([fileInfo objectForKey:@"fname"] != nil && ![@"" isEqualToString:[fileInfo objectForKey:@"fname"]]) {
							if (![[fileInfo objectForKey:@"state"] isEqualToString:@"del"] 
								&& ![[fileInfo objectForKey:@"state"] isEqualToString:@"addDel"]) {
								label = [label stringByAppendingFormat:@"%@,",[fileInfo objectForKey:@"fname"]];
							}
						}
					}
					if ([label isEqualToString:@""]) {
						value = @"";
					}else {
						value = [label substringToIndex:[label length] - 1];
					}
				}else if ([fileInfos count] == 1) {
					if (![[[fileInfos objectAtIndex:0] objectForKey:@"state"] isEqualToString:@"del"] 
						&& ![[[fileInfos objectAtIndex:0] objectForKey:@"state"] isEqualToString:@"addDel"]) {
						value = [[fileInfos objectAtIndex:0] objectForKey:@"fname"] == nil?@"":[[fileInfos objectAtIndex:0] objectForKey:@"fname"];			
					}
				}else {
					value = @"";
				}
			}			
			else {
				value = @"";
			}
		}
			break;
		default:
		{	
			if ([fieldData objectForKey:@"lbl"] != nil) { 
				value = [fieldData objectForKey:@"lbl"];
			}else {
				value = [fieldData objectForKey:@"value"] == nil?@"":[fieldData objectForKey:@"value"];
			}	
		}
			break;

	}

	return [value retain];
}

+ (NSString *)getFieldTextValue:(NSMutableDictionary *)record
						appItem:(NSMutableDictionary *)appItem
				   selectOption:(NSMutableDictionary *)so {
	NSString *value;
	if (record != nil) {
		if ([record objectForKey:@"data"]) {
			NSMutableDictionary *datas = [record objectForKey:@"data"];
			if (datas != nil) {
				NSString *fieldName = [self getFieldName:appItem];
				NSMutableDictionary *fieldData = [datas objectForKey:fieldName];
				if (fieldData != nil) {
					value = [self convertValue:appItem
									 fieldData:fieldData
								  selectOption:so];
					return value;
				}
			}
		}
	}
	return @"";
}

+ (NSMutableDictionary *)getFieldTextStyle:(NSMutableDictionary *)record
								   appItem:(NSMutableDictionary *)appItem {
	if (record != nil) {
		if ([record objectForKey:@"data"]) {
			NSMutableDictionary *datas = [record objectForKey:@"data"];
			if (datas != nil) {
				NSString *fieldName = [self getFieldName:appItem];
				NSMutableDictionary *fieldData = [datas objectForKey:fieldName];
				if (fieldData != nil) {
					if ([fieldData objectForKey:@"style"]) {
						return [fieldData objectForKey:@"style"];
					}
				}
			}
		}
	}
	return nil;
}

+ (NSMutableArray *)getButtons:(NSMutableArray *)dataButtons
					cfgButtons:(NSMutableArray *)cfgButtons {
	NSMutableArray *buttons = nil;
	if (cfgButtons != nil) {
		if (dataButtons == nil || [dataButtons count] == 0) {
			return [NSMutableArray array];
		} else {
			buttons = [NSMutableArray array];
			for(int i = 0; i < [cfgButtons count]; i++) {
				NSMutableDictionary *cfgButton = [cfgButtons objectAtIndex:i];
				for(int j = 0; j < [dataButtons count]; j++){
					NSMutableDictionary *dataButton = [dataButtons objectAtIndex:j];
					if ([dataButton objectForKey:@"id"] != nil && [cfgButton objectForKey:@"id"] != nil
						&& ![@"" isEqualToString:[dataButton objectForKey:@"id"]]
						&& ![@"" isEqualToString:[cfgButton objectForKey:@"id"]] 
						&& [[dataButton objectForKey:@"id"] isEqualToString:[cfgButton objectForKey:@"id"]]
						&& [dataButton objectForKey:@"url"] != nil) {
						[dataButton setObject:[cfgButton objectForKey:@"cfm"] == nil?@"":[cfgButton objectForKey:@"cfm"] forKey:@"cfm"];
						[dataButton setObject:[cfgButton objectForKey:@"cfmi"] == nil?@"":[cfgButton objectForKey:@"cfmi"] forKey:@"cfmi"];
						[dataButton setObject:[cfgButton objectForKey:@"pck"] == nil?@"":[cfgButton objectForKey:@"pck"] forKey:@"pck"];
						[dataButton setObject:[cfgButton objectForKey:@"lbl"] == nil?@"":[cfgButton objectForKey:@"lbl"] forKey:@"lbl"];
						if ([cfgButton objectForKey:@"style"]) {
							[dataButton setObject:[cfgButton objectForKey:@"style"] forKey:@"style"];
						}
						[buttons addObject:dataButton];
					}	
				}
			}
		}
	}
	return buttons;
}

+ (NSMutableArray *)getWithFormButtons:(NSMutableArray *)originalButtons {
	NSMutableArray *withFormButtons = [[NSMutableArray alloc] init];
	for (int i = 0; i < [originalButtons count]; i++) {
		NSMutableDictionary *button = [originalButtons objectAtIndex:i];
		if ([button objectForKey:@"style"]) {
			NSMutableDictionary *buttonStyle = [button objectForKey:@"style"];
			if ([@"W" isEqualToString:[buttonStyle objectForKey:@"button_location"]]) {
				NSMutableDictionary *buttonCopy = [self getObjectCopy:button];
				[withFormButtons addObject:buttonCopy];
				[originalButtons removeObjectAtIndex:i];
				i--;
			}
		}
	}
	return withFormButtons;
}

+ (int)getWithFormButtonsBarHeight:(NSMutableArray *)withFormButtons
						 buttonCol:(int)buttonCol {
	int count = 0;
	for (int i = 0; i < [withFormButtons count]; i++) {
		NSMutableDictionary *withFormButton = [withFormButtons objectAtIndex:i];
		if ([withFormButton objectForKey:@"style"]) {
			NSMutableDictionary *style = [withFormButton objectForKey:@"style"];
			if ([style objectForKey:@"colspan"]) {
				int colspan = [[style objectForKey:@"colspan"] intValue];
				if (colspan > buttonCol) {
					colspan = buttonCol;
				}
				if (colspan == 0) {
					colspan = 1;
				}
				count = count + colspan;
			}
			else {
				count++;
			}
		}else {
			count++;
		}
	}
	int withFormButtonBarCount = 0;
	if (count > 0 && buttonCol > 0) {
		withFormButtonBarCount = count/buttonCol;
		if (count%buttonCol > 0) {
			withFormButtonBarCount = withFormButtonBarCount + 1;
		}
		return withFormButtonBarCount*nWithFormButtonsBarHeight;
	}
	return 0;
}

+ (UIToolbar *)getPageBar:(bool)hasQueryField delegate:(id)aDelegate {
	UIToolbar *pageBar = [UIToolbar new];
	pageBar.tag = -12345;
	pageBar.barStyle = UIBarStyleDefault;
	[pageBar sizeToFit];
	MCUserDefaults* userDefault = [MCUserDefaults instance];
	
	pageBar.tintColor = userDefault.skin_navigationBarColor;
	pageBar.frame = CGRectMake(0.0, 380.0, 320.0, 36.0);
	
	UIBarButtonItem *previousPage = [[UIBarButtonItem alloc] initWithTitle:@"上页" style:UIBarButtonItemStyleBordered target:aDelegate action:@selector(goPrevious:)];
	UIBarButtonItem *nextPage = [[UIBarButtonItem alloc] initWithTitle:@"下页" style:UIBarButtonItemStyleBordered target:aDelegate action:@selector(goNext:)];
	
	UITextField *inputView = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 36, 25)];
	inputView.borderStyle = UITextBorderStyleRoundedRect;
	inputView.textAlignment = UITextAlignmentRight;
	inputView.text = @"-";
	inputView.keyboardType = UIKeyboardTypeNumberPad;
	inputView.tag = 1;
	
	UILabel *pageLabel = [[UILabel alloc] initWithFrame:CGRectMake(38, 0, 27, 25)];
	pageLabel.textAlignment = UITextAlignmentLeft;
	pageLabel.backgroundColor = [UIColor clearColor];
	pageLabel.text = @"/-";
	pageLabel.textColor = [UIColor whiteColor];
	pageLabel.tag = 2;

	UIView *pageView = [[UIView alloc]initWithFrame:CGRectMake(0, 10, 65, 25)];
	[pageView addSubview:inputView];
	[pageView addSubview:pageLabel];
	
	UIBarButtonItem *inputPage = [[UIBarButtonItem alloc] initWithCustomView:pageView];
	
	UIBarButtonItem *refresh = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"btn_page_reload.png"] style:UIBarButtonItemStyleBordered target:aDelegate action:@selector(reload:)];
	UIBarButtonItem *query = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"btn_page_search.png"] style:UIBarButtonItemStyleBordered target:aDelegate action:@selector(search:)];
	
	UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
	UIBarButtonItem *gotoPage = [[UIBarButtonItem alloc] initWithTitle:@"跳转" style:UIBarButtonItemStyleBordered target:aDelegate action:@selector(gotoPage:)];	
	
	NSArray *items;	
	if (hasQueryField) {		
		items = [NSArray arrayWithObjects: previousPage, flexItem, nextPage, flexItem, inputPage, flexItem, gotoPage, flexItem, refresh, flexItem, query, nil];
	} else {
		items = [NSArray arrayWithObjects: previousPage, flexItem, nextPage, flexItem, inputPage, flexItem, gotoPage, flexItem, refresh, nil];
	}
	[previousPage release];
	[nextPage release];
	[refresh release];
	[query release];
	[inputPage release];
	[flexItem release];
	[gotoPage release];
	[inputView release];
	
	[pageBar setItems:items animated:NO];

	return pageBar;
}

+ (NSMutableArray *)getAListInfo:(NSMutableDictionary *)listlayout
						listData:(NSMutableArray *)listData
						rowIndex:(int)rowIndex 
					   cellWidth:(float)cellWidth {
	NSMutableArray *listFields = [listlayout objectForKey:@"item"];
	NSMutableDictionary *record = [listData objectAtIndex:rowIndex];
	NSString *key = [record objectForKey:@"key"] == nil?@"":[record objectForKey:@"key"];
	NSMutableArray *cellInfos = [NSMutableArray array];
	
	int fieldOrder = 1;
	float startX = 0.0;
	float startY = 0.0;
	
	float spaceY = 6.0;
	float previousFieldHeight = 0.0;
	float cellHeight = 0.0;
	
	for (int i = 0;i < [listFields count]; i++) {
		NSMutableDictionary *appItem = [listFields objectAtIndex:i];
		if ([[appItem objectForKey:@"v"] boolValue]) {
			NSString *fieldName = [self getFieldName:appItem];
			NSString *fieldValue = [self getFieldTextValue:record appItem:appItem selectOption:nil];
			NSString *fieldType = [self getFieldType:appItem];
			float fieldWidth = 100.0f;
			int row = 1;
			float fontSize = 16.0f;
			NSString *fontColor = @"000000";
			NSString *fontStyle = @"S";
			NSString *fontAlign = @"";
			
			NSMutableDictionary *fieldData = [[record objectForKey:@"data"] objectForKey:fieldName];
			if ([fieldData objectForKey:@"style"]) {
				NSMutableDictionary *style = [fieldData objectForKey:@"style"];
				if ([style objectForKey:@"width"]) {
					fieldWidth = [[style objectForKey:@"width"] floatValue];
				}
				if ([style objectForKey:@"row"]) {
					row = [[style objectForKey:@"row"] intValue];
				}
				if ([style objectForKey:@"font_size"]) {
					fontSize = [[style objectForKey:@"font_size"] floatValue]/0.75;
				}
				if ([style objectForKey:@"font_color"]) {
					fontColor = [style objectForKey:@"font_color"];
				}
				if ([style objectForKey:@"font_style"]) {
					fontStyle = [style objectForKey:@"font_style"];
				}
				if ([style objectForKey:@"font_align"]) {
					fontAlign = [style objectForKey:@"font_align"];
				}
			}
			NSMutableDictionary *cellInfo = [NSMutableDictionary dictionary];
			//主键
			[cellInfo setObject:key forKey:@"key"];
			//域类型
			[cellInfo setObject:fieldType forKey:@"fieldType"];
			//域占几行
			[cellInfo setObject:[NSNumber numberWithInt:row] forKey:@"row"];
			//域值
			[cellInfo setObject:fieldValue forKey:@"value"];
			if ([fieldType isEqualToString:@"S"]) {
				[cellInfo setObject:fieldData forKey:@"value"];
				[cellInfos addObject:cellInfo];
				[cellInfo setObject:[NSNumber numberWithFloat:cellHeight] forKey:@"cellHeight"];
				continue;
			}
			fieldWidth = fieldWidth / 100 * (cellWidth - 30);
			startX = startX + fieldWidth;
			float fieldHeight = (fontSize + spaceY) * row;
			if ([fieldType isEqualToString:@"H"] 
				|| [fieldType isEqualToString:@"K"]
				|| [fieldType isEqualToString:@"I"] 
				|| [fieldType isEqualToString:@"L"]){
				NSArray *selectIcons = [fieldValue componentsSeparatedByString:@"::"];
				if ([selectIcons count] > 1) {
					fieldHeight = 28 * row;
				} 
			}
			
			//域宽度
			[cellInfo setObject:[NSNumber numberWithFloat:fieldWidth] forKey:@"fieldWidth"];
			//域字体大小
			[cellInfo setObject:[NSNumber numberWithFloat:fontSize] forKey:@"fontSize"];
			//域字体颜色
			[cellInfo setObject:fontColor forKey:@"fontColor"];
			//域字体样式
			[cellInfo setObject:fontStyle forKey:@"fontStyle"];
			//域对齐方式
			[cellInfo setObject:fontAlign forKey:@"fontAlign"];
			
			if (startX == cellWidth - 30) {
				//域位于该行第几个，从1开始
				[cellInfo setObject:[NSNumber numberWithInt:fieldOrder] forKey:@"fieldOrder"];
				//域起始纵坐标
				[cellInfo setObject:[NSNumber numberWithFloat:startY] forKey:@"startY"];
				//域高度
				[cellInfo setObject:[NSNumber numberWithFloat:fieldHeight] forKey:@"fieldHeight"];
				fieldOrder = 1;	 
				startX = 0;	
				startY = startY + fieldHeight;
				cellHeight = startY;
			}
			else if (startX > cellWidth - 30){
				fieldOrder = 1;
				startX = ((int)fieldWidth) % ((int)cellWidth - 30);
				startY = startY + previousFieldHeight;
				
				[cellInfo setObject:[NSNumber numberWithInt:fieldOrder] forKey:@"fieldOrder"];
				[cellInfo setObject:[NSNumber numberWithFloat:startY] forKey:@"startY"];
				[cellInfo setObject:[NSNumber numberWithFloat:fieldHeight] forKey:@"fieldHeight"];
				startY = startY + fieldHeight;
				cellHeight = startY;
			}
			else {
				[cellInfo setObject:[NSNumber numberWithInt:fieldOrder] forKey:@"fieldOrder"];
				[cellInfo setObject:[NSNumber numberWithFloat:startY] forKey:@"startY"];
				[cellInfo setObject:[NSNumber numberWithFloat:fieldHeight] forKey:@"fieldHeight"];
				fieldOrder++;
				cellHeight = startY + fieldHeight;
			}
			previousFieldHeight = fieldHeight;
			[cellInfo setObject:[NSNumber numberWithFloat:cellHeight] forKey:@"cellHeight"];
			[cellInfos addObject:cellInfo];
		}
	}
	return cellInfos;
}

+ (UITableViewCell *)getAListCell:(NSMutableArray *)aListInfo
					  imagesCache:(NSMutableDictionary *)imagesCache
						 rowIndex:(int)rowIndex
					isMultiSelect:(bool)isMultiSelect 
						cellWidth:(float)cellWidth
					   cellHeight:(float)cellHeight
					   imageWidth:(float)imageWidth
					  imageHeight:(float)imageHeight {
    
    
	NSString *AListCellIdentifier = [NSString stringWithFormat:@"AListCellIdentifier-%d-%d", 0, rowIndex];
	UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:AListCellIdentifier] autorelease];
	cell.selectionStyle = UITableViewCellSelectionStyleBlue;//选中行的颜色
	if (rowIndex % 2) {
		cell.backgroundView = [[[ColorBackgroundView alloc] initWithLineFlag:NO] autorelease];
	}else {
		cell.backgroundView = [[[ColorBackgroundView alloc] initWithLineFlag:YES] autorelease];
	}
	if (isMultiSelect) {
		cell.accessoryType = UITableViewCellAccessoryNone;
	} else {
		cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
	}
	float aListStartX = 0.0;
	for (NSMutableDictionary *cellInfo in aListInfo) {
		NSString *fieldType = [cellInfo objectForKey:@"fieldType"];
		if ([fieldType isEqualToString:@"S"]) {
			NSString *key = [cellInfo objectForKey:@"key"];
			NSMutableDictionary *fieldData = [cellInfo objectForKey:@"value"];
			MCImageView *imageView = nil;
			if ([imagesCache objectForKey:[NSString stringWithFormat:@"%d-%@", rowIndex, key]]) {
				imageView = [imagesCache objectForKey:[NSString stringWithFormat:@"%d-%@", rowIndex, key]];
				imageView.frame = CGRectMake(10.0, 6.0, imageWidth, imageHeight);
				[cell.contentView addSubview:imageView];
				if (imageWidth > 0) {
					aListStartX = 10.0 + imageWidth;
				}
			}else {
//                NSLog(@"执行到这里了吧"); 白菜 2013年03月09日17:18:17 这是为了改善图片显示方式
//				imageView = [[MCImageView alloc] initWithFrame:CGRectMake(10.0, 6.0, imageWidth, imageHeight)];
//				imageView.autoresizingMask = nCheckCodeAutoresizingMask;
//				[cell.contentView addSubview:imageView];
//				if (imageWidth > 0) {
//					aListStartX = 10.0 + imageWidth;
//				}
				
				NSString *dataFrom = [fieldData objectForKey:@"df"] == nil?@"":[fieldData objectForKey:@"df"];
				NSMutableArray *fileInfos = [fieldData objectForKey:@"fi"];
				if (fileInfos == nil || [fileInfos count] < 1) 
					break;
				NSMutableDictionary *fileInfo = [fileInfos objectAtIndex:0];
				NSString *fileName = [fileInfo objectForKey:@"fname"];
				if (fileName == nil || [fileName length] == 0)
					break;
				
//				[imagesCache setObject:imageView forKey:[NSString stringWithFormat:@"%d-%@", rowIndex, key]];
				
				NSString *fileLocation = [fileInfo objectForKey:@"lcn"];
				
				NSMutableDictionary *fileAttribute = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
													  fileName,@"fileName",
													  fileLocation,@"fileLocation",
													  @"download",@"actionType",
													  dataFrom,@"dataFrom",
													  @"0", @"indexPath_section",
													  [NSString stringWithFormat:@"%d", rowIndex], @"indexPath_row",
													  nil];
				if (imageView.image == nil) {
					imageView.fileAttribute = fileAttribute;
					[fileAttribute release];
				}				
			}
			break;
		}
	}
	AListCell *aListCell = [[AListCell alloc] initWithFrame:CGRectMake(aListStartX, 6.0, cellWidth, cellHeight)];
	[aListCell addFieldOfCell:aListInfo];
	[cell.contentView addSubview:aListCell];
	[aListCell release];
	return cell;
}

+ (bool) hasQueryField:(NSMutableDictionary *)listLayout {
	if (![listLayout objectForKey:@"item"]) {
		return NO;
	}
	NSString *queryMode;
	for (NSMutableDictionary *listField in [listLayout objectForKey:@"item"]) {
		queryMode = [listField objectForKey:@"qmode"];
		if (queryMode == nil || [queryMode length] == 0 || [queryMode intValue] == 0) {
			continue;
		}
		return YES;
	}
	return NO;
}

+ (int)getFieldLength:(NSMutableDictionary *)appItem {
	NSMutableDictionary *field = [self getField:appItem];
	int length;
	NSString *fieldType = [field objectForKey:@"type"];
	if ([fieldType isEqualToString:@"Q"])
		length = 14;
	else if ([fieldType isEqualToString:@"3"] || [fieldType isEqualToString:@"4"]) 
		length = 14;
	else if ([fieldType isEqualToString:@"C"])
		length = 14;
	else if ([fieldType isEqualToString:@"D"])
		length = 20;
	else if ([fieldType isEqualToString:@"S"] || [fieldType isEqualToString:@"J"] || [fieldType isEqualToString:@"Y"])
		length = 20;
	else if ([fieldType isEqualToString:@"H"] || [fieldType isEqualToString:@"K"])
		length = 10;
	else if ([fieldType isEqualToString:@"I"] || [fieldType isEqualToString:@"L"])
		length = 18;
	else{
		if (![field objectForKey:@"lng"]) {
			length = 15;
		}else {
			length = [[field objectForKey:@"lng"] intValue];
			if (length == 0) {
				length = 15;
			}
		}
	}
	NSString *label = [field objectForKey:@"lbl"] == nil?@"":[field objectForKey:@"lbl"];
	length = MIN(MAX(length,[label lengthOfBytesUsingEncoding:NSUTF8StringEncoding]),20);
	return length;
}

+ (id)getObjectCopy:(id)object {
	NSString *jsonString = [object JSONRepresentation];	
	
	id objectCopy = [jsonString JSONValue];
	return objectCopy;
}

+ (UIImage*)copyScreen
{
	MClientAppDelegate *appDelegate = (MClientAppDelegate*)[[UIApplication sharedApplication] delegate];
	UINavigationController* navController = [appDelegate navController];
	
	BOOL isPortrait = UIInterfaceOrientationIsPortrait(navController.interfaceOrientation);
	
	CGSize size = CGSizeMake(isPortrait ? navController.view.frame.size.width : navController.view.frame.size.height,
							 isPortrait ? navController.view.frame.size.height : navController.view.frame.size.width);
	
	UIGraphicsBeginImageContext(size);
	[navController.view.layer renderInContext:UIGraphicsGetCurrentContext()];
	UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();
	
	return image;
}

+ (CGFloat)getMaxWidth:(NSArray*)listDatas withAppItems:(NSMutableDictionary*)appItem {
	UIFont* font = [UIFont systemFontOfSize:18];
	CGFloat nMaxWidth = 0;
	for (NSMutableDictionary *record in listDatas) {
		NSString *strValue = [MCUIToolkit getFieldTextValue:record appItem:appItem selectOption:nil];
		CGSize size = [strValue sizeWithFont:font];
		if (nMaxWidth < size.width) {
			nMaxWidth = size.width;
		}
	}
	return nMaxWidth + 10;
}

static NSString* ChineseFirstPY = @"YDYQSXMWZSSXJBYMGCCZQPSSQBYCDSCDQLDYLYBSSJGYZZJJFKCCLZDHWDWZJLJPFYYNWJJTMYHZWZHFLZPPQHGSCYYYNJQYXXGJ"
                                  @"HHSDSJNKKTMOMLCRXYPSNQSECCQZGGLLYJLMYZZSECYKYYHQWJSSGGYXYZYJWWKDJHYCHMYXJTLXJYQBYXZLDWRDJRWYSRLDZJPC"
                                  @"BZJJBRCFTLECZSTZFXXZHTRQHYBDLYCZSSYMMRFMYQZPWWJJYFCRWFDFZQPYDDWYXKYJAWJFFXYPSFTZYHHYZYSWCJYXSCLCXXWZ"
                                  @"ZXNBGNNXBXLZSZSBSGPYSYZDHMDZBQBZCWDZZYYTZHBTSYYFZGNTNXQYWQSKBPHHLXGYBFMJEBJHHGQTJCYSXSTKZHLYCKGLYSMZ"
                                  @"XYALMELDCCXGZYRJXSDLTYZCQKCNNJWHJTZZCQLJSTSTBNXBTYXCEQXGKWJYFLZQLYHYXSPSFXLMPBYSXXXYDJCZYLLLSJXFHJXP"
                                  @"JBTFFYABYXBHZZBJYZLWLCZGGBTSSMDTJZXPTHYQTGLJSCQFZKJZJQNLZWLSLHDZBWJNCJZYZSQQYCQYRZCJJWYBRTWPYFTWEXCS"
                                  @"KDZCTBZHYZZYYJXZCFFZZMJYXXSDZZOTTBZLQWFCKSZSXFYRLNYJMBDTHJXSQQCCSBXYYTSYFBXDZTGBCNSLCYZZPSAZYZZSCJCS"
                                  @"HZQYDXLBPJLLMQXTYDZXSQJTZPXLCGLQTZWJBHCTSYJSFXYEJJTLBGXSXJMYJQQPFZASYJNTYDJXKJCDJSZCBARTDCLYJQMWNQNC"
                                  @"LLLKBYBZZSYHQQLTWLCCXTXLLZNTYLNEWYZYXCZXXGRKRMTCNDNJTSYYSSDQDGHSDBJGHRWRQLYBGLXHLGTGXBQJDZPYJSJYJCTM"
                                  @"RNYMGRZJCZGJMZMGXMPRYXKJNYMSGMZJYMKMFXMLDTGFBHCJHKYLPFMDXLQJJSMTQGZSJLQDLDGJYCALCMZCSDJLLNXDJFFFFJCZ"
                                  @"FMZFFPFKHKGDPSXKTACJDHHZDDCRRCFQYJKQCCWJDXHWJLYLLZGCFCQDSMLZPBJJPLSBCJGGDCKKDEZSQCCKJGCGKDJTJDLZYCXK"
                                  @"LQSCGJCLTFPCQCZGWPJDQYZJJBYJHSJDZWGFSJGZKQCCZLLPSPKJGQJHZZLJPLGJGJJTHJJYJZCZMLZLYQBGJWMLJKXZDZNJQSYZ"
                                  @"MLJLLJKYWXMKJLHSKJGBMCLYYMKXJQLBMLLKMDXXKWYXYSLMLPSJQQJQXYXFJTJDXMXXLLCXQBSYJBGWYMBGGBCYXPJYGPEPFGDJ"
                                  @"GBHBNSQJYZJKJKHXQFGQZKFHYGKHDKLLSDJQXPQYKYBNQSXQNSZSWHBSXWHXWBZZXDMNSJBSBKBBZKLYLXGWXDRWYQZMYWSJQLCJ"
                                  @"XXJXKJEQXSCYETLZHLYYYSDZPAQYZCMTLSHTZCFYZYXYLJSDCJQAGYSLCQLYYYSHMRQQKLDXZSCSSSYDYCJYSFSJBFRSSZQSBXXP"
                                  @"XJYSDRCKGJLGDKZJZBDKTCSYQPYHSTCLDJDHMXMCGXYZHJDDTMHLTXZXYLYMOHYJCLTYFBQQXPFBDFHHTKSQHZYYWCNXXCRWHOWG"
                                  @"YJLEGWDQCWGFJYCSNTMYTOLBYGWQWESJPWNMLRYDZSZTXYQPZGCWXHNGPYXSHMYQJXZTDPPBFYHZHTJYFDZWKGKZBLDNTSXHQEEG"
                                  @"ZZYLZMMZYJZGXZXKHKSTXNXXWYLYAPSTHXDWHZYMPXAGKYDXBHNHXKDPJNMYHYLPMGOCSLNZHKXXLPZZLBMLSFBHHGYGYYGGBHSC"
                                  @"YAQTYWLXTZQCEZYDQDQMMHTKLLSZHLSJZWFYHQSWSCWLQAZYNYTLSXTHAZNKZZSZZLAXXZWWCTGQQTDDYZTCCHYQZFLXPSLZYGPZ"
                                  @"SZNGLNDQTBDLXGTCTAJDKYWNSYZLJHHZZCWNYYZYWMHYCHHYXHJKZWSXHZYXLYSKQYSPSLYZWMYPPKBYGLKZHTYXAXQSYSHXASMC"
                                  @"HKDSCRSWJPWXSGZJLWWSCHSJHSQNHCSEGNDAQTBAALZZMSSTDQJCJKTSCJAXPLGGXHHGXXZCXPDMMHLDGTYBYSJMXHMRCPXXJZCK"
                                  @"ZXSHMLQXXTTHXWZFKHCCZDYTCJYXQHLXDHYPJQXYLSYYDZOZJNYXQEZYSQYAYXWYPDGXDDXSPPYZNDLTWRHXYDXZZJHTCXMCZLHP"
                                  @"YYYYMHZLLHNXMYLLLMDCPPXHMXDKYCYRDLTXJCHHZZXZLCCLYLNZSHZJZZLNNRLWHYQSNJHXYNTTTKYJPYCHHYEGKCTTWLGQRLGG"
                                  @"TGTYGYHPYHYLQYQGCWYQKPYYYTTTTLHYHLLTYTTSPLKYZXGZWGPYDSSZZDQXSKCQNMJJZZBXYQMJRTFFBTKHZKBXLJJKDXJTLBWF"
                                  @"ZPPTKQTZTGPDGNTPJYFALQMKGXBDCLZFHZCLLLLADPMXDJHLCCLGYHDZFGYDDGCYYFGYDXKSSEBDHYKDKDKHNAXXYBPBYYHXZQGA"
                                  @"FFQYJXDMLJCSQZLLPCHBSXGJYNDYBYQSPZWJLZKSDDTACTBXZDYZYPJZQSJNKKTKNJDJGYYPGTLFYQKASDNTCYHBLWDZHBBYDWJR"
                                  @"YGKZYHEYYFJMSDTYFZJJHGCXPLXHLDWXXJKYTCYKSSSMTWCTTQZLPBSZDZWZXGZAGYKTYWXLHLSPBCLLOQMMZSSLCMBJCSZZKYDC"
                                  @"ZJGQQDSMCYTZQQLWZQZXSSFPTTFQMDDZDSHDTDWFHTDYZJYQJQKYPBDJYYXTLJHDRQXXXHAYDHRJLKLYTWHLLRLLRCXYLBWSRSZZ"
                                  @"SYMKZZHHKYHXKSMDSYDYCJPBZBSQLFCXXXNXKXWYWSDZYQOGGQMMYHCDZTTFJYYBGSTTTYBYKJDHKYXBELHTYPJQNFXFDYKZHQKZ"
                                  @"BYJTZBXHFDXKDASWTAWAJLDYJSFHBLDNNTNQJTJNCHXFJSRFWHZFMDRYJYJWZPDJKZYJYMPCYZNYNXFBYTFYFWYGDBNZZZDNYTXZ"
                                  @"EMMQBSQEHXFZMBMFLZZSRXYMJGSXWZJSPRYDJSJGXHJJGLJJYNZZJXHGXKYMLPYYYCXYTWQZSWHWLYRJLPXSLSXMFSWWKLCTNXNY"
                                  @"NPSJSZHDZEPTXMYYWXYYSYWLXJQZQXZDCLEEELMCPJPCLWBXSQHFWWTFFJTNQJHJQDXHWLBYZNFJLALKYYJLDXHHYCSTYYWNRJYX"
                                  @"YWTRMDRQHWQCMFJDYZMHMYYXJWMYZQZXTLMRSPWWCHAQBXYGZYPXYYRRCLMPYMGKSJSZYSRMYJSNXTPLNBAPPYPYLXYYZKYNLDZY"
                                  @"JZCZNNLMZHHARQMPGWQTZMXXMLLHGDZXYHXKYXYCJMFFYYHJFSBSSQLXXNDYCANNMTCJCYPRRNYTYQNYYMBMSXNDLYLYSLJRLXYS"
                                  @"XQMLLYZLZJJJKYZZCSFBZXXMSTBJGNXYZHLXNMCWSCYZYFZLXBRNNNYLBNRTGZQYSATSWRYHYJZMZDHZGZDWYBSSCSKXSYHYTXXG"
                                  @"CQGXZZSHYXJSCRHMKKBXCZJYJYMKQHZJFNBHMQHYSNJNZYBKNQMCLGQHWLZNZSWXKHLJHYYBQLBFCDSXDLDSPFZPSKJYZWZXZDDX"
                                  @"JSMMEGJSCSSMGCLXXKYYYLNYPWWWGYDKZJGGGZGGSYCKNJWNJPCXBJJTQTJWDSSPJXZXNZXUMELPXFSXTLLXCLJXJJLJZXCTPSWX"
                                  @"LYDHLYQRWHSYCSQYYBYAYWJJJQFWQCQQCJQGXALDBZZYJGKGXPLTZYFXJLTPADKYQHPMATLCPDCKBMTXYBHKLENXDLEEGQDYMSAW"
                                  @"HZMLJTWYGXLYQZLJEEYYBQQFFNLYXRDSCTGJGXYYNKLLYQKCCTLHJLQMKKZGCYYGLLLJDZGYDHZWXPYSJBZKDZGYZZHYWYFQYTYZ"
                                  @"SZYEZZLYMHJJHTSMQWYZLKYYWZCSRKQYTLTDXWCTYJKLWSQZWBDCQYNCJSRSZJLKCDCDTLZZZACQQZZDDXYPLXZBQJYLZLLLQDDZ"
                                  @"QJYJYJZYXNYYYNYJXKXDAZWYRDLJYYYRJLXLLDYXJCYWYWNQCCLDDNYYYNYCKCZHXXCCLGZQJGKWPPCQQJYSBZZXYJSQPXJPZBSB"
                                  @"DSFNSFPZXHDWZTDWPPTFLZZBZDMYYPQJRSDZSQZSQXBDGCPZSWDWCSQZGMDHZXMWWFYBPDGPHTMJTHZSMMBGZMBZJCFZWFZBBZMQ"
                                  @"CFMBDMCJXLGPNJBBXGYHYYJGPTZGZMQBQTCGYXJXLWZKYDPDYMGCFTPFXYZTZXDZXTGKMTYBBCLBJASKYTSSQYYMSZXFJEWLXLLS"
                                  @"ZBQJJJAKLYLXLYCCTSXMCWFKKKBSXLLLLJYXTYLTJYYTDPJHNHNNKBYQNFQYYZBYYESSESSGDYHFHWTCJBSDZZTFDMXHCNJZYMQW"
                                  @"SRYJDZJQPDQBBSTJGGFBKJBXTGQHNGWJXJGDLLTHZHHYYYYYYSXWTYYYCCBDBPYPZYCCZYJPZYWCBDLFWZCWJDXXHYHLHWZZXJTC"
                                  @"ZLCDPXUJCZZZLYXJJTXPHFXWPYWXZPTDZZBDZCYHJHMLXBQXSBYLRDTGJRRCTTTHYTCZWMXFYTWWZCWJWXJYWCSKYBZSCCTZQNHX"
                                  @"NWXXKHKFHTSWOCCJYBCMPZZYKBNNZPBZHHZDLSYDDYTYFJPXYNGFXBYQXCBHXCPSXTYZDMKYSNXSXLHKMZXLYHDHKWHXXSSKQYHH"
                                  @"CJYXGLHZXCSNHEKDTGZXQYPKDHEXTYKCNYMYYYPKQYYYKXZLTHJQTBYQHXBMYHSQCKWWYLLHCYYLNNEQXQWMCFBDCCMLJGGXDQKT"
                                  @"LXKGNQCDGZJWYJJLYHHQTTTNWCHMXCXWHWSZJYDJCCDBQCDGDNYXZTHCQRXCBHZTQCBXWGQWYYBXHMBYMYQTYEXMQKYAQYRGYZSL"
                                  @"FYKKQHYSSQYSHJGJCNXKZYCXSBXYXHYYLSTYCXQTHYSMGSCPMMGCCCCCMTZTASMGQZJHKLOSQYLSWTMXSYQKDZLJQQYPLSYCZTCQ"
                                  @"QPBBQJZCLPKHQZYYXXDTDDTSJCXFFLLCHQXMJLWCJCXTSPYCXNDTJSHJWXDQQJSKXYAMYLSJHMLALYKXCYYDMNMDQMXMCZNNCYBZ"
                                  @"KKYFLMCHCMLHXRCJJHSYLNMTJZGZGYWJXSRXCWJGJQHQZDQJDCJJZKJKGDZQGJJYJYLXZXXCDQHHHEYTMHLFSBDJSYYSHFYSTCZQ"
                                  @"LPBDRFRZTZYKYWHSZYQKWDQZRKMSYNBCRXQBJYFAZPZZEDZCJYWBCJWHYJBQSZYWRYSZPTDKZPFPBNZTKLQYHBBZPNPPTYZZYBQN"
                                  @"YDCPJMMCYCQMCYFZZDCMNLFPBPLNGQJTBTTNJZPZBBZNJKLJQYLNBZQHKSJZNGGQSZZKYXSHPZSNBCGZKDDZQANZHJKDRTLZLSWJ"
                                  @"LJZLYWTJNDJZJHXYAYNCBGTZCSSQMNJPJYTYSWXZFKWJQTKHTZPLBHSNJZSYZBWZZZZLSYLSBJHDWWQPSLMMFBJDWAQYZTCJTBNN"
                                  @"WZXQXCDSLQGDSDPDZHJTQQPSWLYYJZLGYXYZLCTCBJTKTYCZJTQKBSJLGMGZDMCSGPYNJZYQYYKNXRPWSZXMTNCSZZYXYBYHYZAX"
                                  @"YWQCJTLLCKJJTJHGDXDXYQYZZBYWDLWQCGLZGJGQRQZCZSSBCRPCSKYDZNXJSQGXSSJMYDNSTZTPBDLTKZWXQWQTZEXNQCZGWEZK"
                                  @"SSBYBRTSSSLCCGBPSZQSZLCCGLLLZXHZQTHCZMQGYZQZNMCOCSZJMMZSQPJYGQLJYJPPLDXRGZYXCCSXHSHGTZNLZWZKJCXTCFCJ"
                                  @"XLBMQBCZZWPQDNHXLJCTHYZLGYLNLSZZPCXDSCQQHJQKSXZPBAJYEMSMJTZDXLCJYRYYNWJBNGZZTMJXLTBSLYRZPYLSSCNXPHLL"
                                  @"HYLLQQZQLXYMRSYCXZLMMCZLTZSDWTJJLLNZGGQXPFSKYGYGHBFZPDKMWGHCXMSGDXJMCJZDYCABXJDLNBCDQYGSKYDQTXDJJYXM"
                                  @"SZQAZDZFSLQXYJSJZYLBTXXWXQQZBJZUFBBLYLWDSLJHXJYZJWTDJCZFQZQZZDZSXZZQLZCDZFJHYSPYMPQZMLPPLFFXJJNZZYLS"
                                  @"JEYQZFPFZKSYWJJJHRDJZZXTXXGLGHYDXCSKYSWMMZCWYBAZBJKSHFHJCXMHFQHYXXYZFTSJYZFXYXPZLCHMZMBXHZZSXYFYMNCW"
                                  @"DABAZLXKTCSHHXKXJJZJSTHYGXSXYYHHHJWXKZXSSBZZWHHHCWTZZZPJXSNXQQJGZYZYWLLCWXZFXXYXYHXMKYYSWSQMNLNAYCYS"
                                  @"PMJKHWCQHYLAJJMZXHMMCNZHBHXCLXTJPLTXYJHDYYLTTXFSZHYXXSJBJYAYRSMXYPLCKDUYHLXRLNLLSTYZYYQYGYHHSCCSMZCT"
                                  @"ZQXKYQFPYYRPFFLKQUNTSZLLZMWWTCQQYZWTLLMLMPWMBZSSTZRBPDDTLQJJBXZCSRZQQYGWCSXFWZLXCCRSZDZMCYGGDZQSGTJS"
                                  @"WLJMYMMZYHFBJDGYXCCPSHXNZCSBSJYJGJMPPWAFFYFNXHYZXZYLREMZGZCYZSSZDLLJCSQFNXZKPTXZGXJJGFMYYYSNBTYLBNLH"
                                  @"PFZDCYFBMGQRRSSSZXYSGTZRNYDZZCDGPJAFJFZKNZBLCZSZPSGCYCJSZLMLRSZBZZLDLSLLYSXSQZQLYXZLSKKBRXBRBZCYCXZZ"
                                  @"ZEEYFGKLZLYYHGZSGZLFJHGTGWKRAAJYZKZQTSSHJJXDCYZUYJLZYRZDQQHGJZXSSZBYKJPBFRTJXLLFQWJHYLQTYMBLPZDXTZYG"
                                  @"BDHZZRBGXHWNJTJXLKSCFSMWLSDQYSJTXKZSCFWJLBXFTZLLJZLLQBLSQMQQCGCZFPBPHZCZJLPYYGGDTGWDCFCZQYYYQYSSCLXZ"
                                  @"SKLZZZGFFCQNWGLHQYZJJCZLQZZYJPJZZBPDCCMHJGXDQDGDLZQMFGPSYTSDYFWWDJZJYSXYYCZCYHZWPBYKXRYLYBHKJKSFXTZJ"
                                  @"MMCKHLLTNYYMSYXYZPYJQYCSYCWMTJJKQYRHLLQXPSGTLYYCLJSCPXJYZFNMLRGJJTYZBXYZMSJYJHHFZQMSYXRSZCWTLRTQZSST"
                                  @"KXGQKGSPTGCZNJSJCQCXHMXGGZTQYDJKZDLBZSXJLHYQGGGTHQSZPYHJHHGYYGKGGCWJZZYLCZLXQSFTGZSLLLMLJSKCTBLLZZSZ"
                                  @"MMNYTPZSXQHJCJYQXYZXZQZCPSHKZZYSXCDFGMWQRLLQXRFZTLYSTCTMJCXJJXHJNXTNRZTZFQYHQGLLGCXSZSJDJLJCYDSJTLNY"
                                  @"XHSZXCGJZYQPYLFHDJSBPCCZHJJJQZJQDYBSSLLCMYTTMQTBHJQNNYGKYRQYQMZGCJKPDCGMYZHQLLSLLCLMHOLZGDYYFZSLJCQZ"
                                  @"LYLZQJESHNYLLJXGJXLYSYYYXNBZLJSSZCQQCJYLLZLTJYLLZLLBNYLGQCHXYYXOXCXQKYJXXXYKLXSXXYQXCYKQXQCSGYXXYQXY"
                                  @"GYTQOHXHXPYXXXULCYEYCHZZCBWQBBWJQZSCSZSSLZYLKDESJZWMYMCYTSDSXXSCJPQQSQYLYYZYCMDJDZYWCBTJSYDJKCYDDJLB"
                                  @"DJJSODZYSYXQQYXDHHGQQYQHDYXWGMMMAJDYBBBPPBCMUUPLJZSMTXERXJMHQNUTPJDCBSSMSSSTKJTSSMMTRCPLZSZMLQDSDMJM"
                                  @"QPNQDXCFYNBFSDQXYXHYAYKQYDDLQYYYSSZBYDSLNTFQTZQPZMCHDHCZCWFDXTMYQSPHQYYXSRGJCWTJTZZQMGWJJTJHTQJBBHWZ"
                                  @"PXXHYQFXXQYWYYHYSCDYDHHQMNMTMWCPBSZPPZZGLMZFOLLCFWHMMSJZTTDHZZYFFYTZZGZYSKYJXQYJZQBHMBZZLYGHGFMSHPZF"
                                  @"ZSNCLPBQSNJXZSLXXFPMTYJYGBXLLDLXPZJYZJYHHZCYWHJYLSJEXFSZZYWXKZJLUYDTMLYMQJPWXYHXSKTQJEZRPXXZHHMHWQPW"
                                  @"QLYJJQJJZSZCPHJLCHHNXJLQWZJHBMZYXBDHHYPZLHLHLGFWLCHYYTLHJXCJMSCPXSTKPNHQXSRTYXXTESYJCTLSSLSTDLLLWWYH"
                                  @"DHRJZSFGXTSYCZYNYHTDHWJSLHTZDQDJZXXQHGYLTZPHCSQFCLNJTCLZPFSTPDYNYLGMJLLYCQHYSSHCHYLHQYQTMZYPBYWRFQYK"
                                  @"QSYSLZDQJMPXYYSSRHZJNYWTQDFZBWWTWWRXCWHGYHXMKMYYYQMSMZHNGCEPMLQQMTCWCTMMPXJPJJHFXYYZSXZHTYBMSTSYJTTQ"
                                  @"QQYYLHYNPYQZLCYZHZWSMYLKFJXLWGXYPJYTYSYXYMZCKTTWLKSMZSYLMPWLZWXWQZSSAQSYXYRHSSNTSRAPXCPWCMGDXHXZDZYF"
                                  @"JHGZTTSBJHGYZSZYSMYCLLLXBTYXHBBZJKSSDMALXHYCFYGMQYPJYCQXJLLLJGSLZGQLYCJCCZOTYXMTMTTLLWTGPXYMZMKLPSZZ"
                                  @"ZXHKQYSXCTYJZYHXSHYXZKXLZWPSQPYHJWPJPWXQQYLXSDHMRSLZZYZWTTCYXYSZZSHBSCCSTPLWSSCJCHNLCGCHSSPHYLHFHHXJ"
                                  @"SXYLLNYLSZDHZXYLSXLWZYKCLDYAXZCMDDYSPJTQJZLNWQPSSSWCTSTSZLBLNXSMNYYMJQBQHRZWTYYDCHQLXKPZWBGQYBKFCMZW"
                                  @"PZLLYYLSZYDWHXPSBCMLJBSCGBHXLQHYRLJXYSWXWXZSLDFHLSLYNJLZYFLYJYCDRJLFSYZFSLLCQYQFGJYHYXZLYLMSTDJCYHBZ"
                                  @"LLNWLXXYGYYHSMGDHXXHHLZZJZXCZZZCYQZFNGWPYLCPKPYYPMCLQKDGXZGGWQBDXZZKZFBXXLZXJTPJPTTBYTSZZDWSLCHZHSLT"
                                  @"YXHQLHYXXXYYZYSWTXZKHLXZXZPYHGCHKCFSYHUTJRLXFJXPTZTWHPLYXFCRHXSHXKYXXYHZQDXQWULHYHMJTBFLKHTXCWHJFWJC"
                                  @"FPQRYQXCYYYQYGRPYWSGSUNGWCHKZDXYFLXXHJJBYZWTSXXNCYJJYMSWZJQRMHXZWFQSYLZJZGBHYNSLBGTTCSYBYXXWXYHXYYXN"
                                  @"SQYXMQYWRGYQLXBBZLJSYLPSYTJZYHYZAWLRORJMKSCZJXXXYXCHDYXRYXXJDTSQFXLYLTSFFYXLMTYJMJUYYYXLTZCSXQZQHZXL"
                                  @"YYXZHDNBRXXXJCTYHLBRLMBRLLAXKYLLLJLYXXLYCRYLCJTGJCMTLZLLCYZZPZPCYAWHJJFYBDYYZSMPCKZDQYQPBPCJPDCYZMDP"
                                  @"BCYYDYCNNPLMTMLRMFMMGWYZBSJGYGSMZQQQZTXMKQWGXLLPJGZBQCDJJJFPKJKCXBLJMSWMDTQJXLDLPPBXCWRCQFBFQJCZAHZG"
                                  @"MYKPHYYHZYKNDKZMBPJYXPXYHLFPNYYGXJDBKXNXHJMZJXSTRSTLDXSKZYSYBZXJLXYSLBZYSLHXJPFXPQNBYLLJQKYGZMCYZZYM"
                                  @"CCSLCLHZFWFWYXZMWSXTYNXJHPYYMCYSPMHYSMYDYSHQYZCHMJJMZCAAGCFJBBHPLYZYLXXSDJGXDHKXXTXXNBHRMLYJSLTXMRHN"
                                  @"LXQJXYZLLYSWQGDLBJHDCGJYQYCMHWFMJYBMBYJYJWYMDPWHXQLDYGPDFXXBCGJSPCKRSSYZJMSLBZZJFLJJJLGXZGYXYXLSZQYX"
                                  @"BEXYXHGCXBPLDYHWETTWWCJMBTXCHXYQXLLXFLYXLLJLSSFWDPZSMYJCLMWYTCZPCHQEKCQBWLCQYDPLQPPQZQFJQDJHYMMCXTXD"
                                  @"RMJWRHXCJZYLQXDYYNHYYHRSLSRSYWWZJYMTLTLLGTQCJZYABTCKZCJYCCQLJZQXALMZYHYWLWDXZXQDLLQSHGPJFJLJHJABCQZD"
                                  @"JGTKHSSTCYJLPSWZLXZXRWGLDLZRLZXTGSLLLLZLYXXWGDZYGBDPHZPBRLWSXQBPFDWOFMWHLYPCBJCCLDMBZPBZZLCYQXLDOMZB"
                                  @"LZWPDWYYGDSTTHCSQSCCRSSSYSLFYBFNTYJSZDFNDPDHDZZMBBLSLCMYFFGTJJQWFTMTPJWFNLBZCMMJTGBDZLQLPYFHYYMJYLSD"
                                  @"CHDZJWJCCTLJCLDTLJJCPDDSQDSSZYBNDBJLGGJZXSXNLYCYBJXQYCBYLZCFZPPGKCXZDZFZTJJFJSJXZBNZYJQTTYJYHTYCZHYM"
                                  @"DJXTTMPXSPLZCDWSLSHXYPZGTFMLCJTYCBPMGDKWYCYZCDSZZYHFLYCTYGWHKJYYLSJCXGYWJCBLLCSNDDBTZBSCLYZCZZSSQDLL"
                                  @"MQYYHFSLQLLXFTYHABXGWNYWYYPLLSDLDLLBJCYXJZMLHLJDXYYQYTDLLLBUGBFDFBBQJZZMDPJHGCLGMJJPGAEHHBWCQXAXHHHZ"
                                  @"CHXYPHJAXHLPHJPGPZJQCQZGJJZZUZDMQYYBZZPHYHYBWHAZYJHYKFGDPFQSDLZMLJXKXGALXZDAGLMDGXMWZQYXXDXXPFDMMSSY"
                                  @"MPFMDMMKXKSYZYSHDZKXSYSMMZZZMSYDNZZCZXFPLSTMZDNMXCKJMZTYYMZMZZMSXHHDCZJEMXXKLJSTLWLSQLYJZLLZJSSDPPMH"
                                  @"NLZJCZYHMXXHGZCJMDHXTKGRMXFWMCGMWKDTKSXQMMMFZZYDKMSCLCMPCGMHSPXQPZDSSLCXKYXTWLWJYAHZJGZQMCSNXYYMMPML"
                                  @"KJXMHLMLQMXCTKZMJQYSZJSYSZHSYJZJCDAJZYBSDQJZGWZQQXFKDMSDJLFWEHKZQKJPEYPZYSZCDWYJFFMZZYLTTDZZEFMZLBNP"
                                  @"PLPLPEPSZALLTYLKCKQZKGENQLWAGYXYDPXLHSXQQWQCQXQCLHYXXMLYCCWLYMQYSKGCHLCJNSZKPYZKCQZQLJPDMDZHLASXLBYD"
                                  @"WQLWDNBQCRYDDZTJYBKBWSZDXDTNPJDTCTQDFXQQMGNXECLTTBKPWSLCTYQLPWYZZKLPYGZCQQPLLKCCYLPQMZCZQCLJSLQZDJXL"
                                  @"DDHPZQDLJJXZQDXYZQKZLJCYQDYJPPYPQYKJYRMPCBYMCXKLLZLLFQPYLLLMBSGLCYSSLRSYSQTMXYXZQZFDZUYSYZTFFMZZSMZQ"
                                  @"HZSSCCMLYXWTPZGXZJGZGSJSGKDDHTQGGZLLBJDZLCBCHYXYZHZFYWXYZYMSDBZZYJGTSMTFXQYXQSTDGSLNXDLRYZZLRYYLXQHT"
                                  @"XSRTZNGZXBNQQZFMYKMZJBZYMKBPNLYZPBLMCNQYZZZSJZHJCTZKHYZZJRDYZHNPXGLFZTLKGJTCTSSYLLGZRZBBQZZKLPKLCZYS"
                                  @"SUYXBJFPNJZZXCDWXZYJXZZDJJKGGRSRJKMSMZJLSJYWQSKYHQJSXPJZZZLSNSHRNYPZTWCHKLPSRZLZXYJQXQKYSJYCZTLQZYBB"
                                  @"YBWZPQDWWYZCYTJCJXCKCWDKKZXSGKDZXWWYYJQYYTCYTDLLXWKCZKKLCCLZCQQDZLQLCSFQCHQHSFSMQZZLNBJJZBSJHTSZDYSJ"
                                  @"QJPDLZCDCWJKJZZLPYCGMZWDJJBSJQZSYZYHHXJPBJYDSSXDZNCGLQMBTSFSBPDZDLZNFGFJGFSMPXJQLMBLGQCYYXBQKDJJQYRF"
                                  @"KZTJDHCZKLBSDZCFJTPLLJGXHYXZCSSZZXSTJYGKGCKGYOQXJPLZPBPGTGYJZGHZQZZLBJLSQFZGKQQJZGYCZBZQTLDXRJXBSXXP"
                                  @"ZXHYZYCLWDXJJHXMFDZPFZHQHQMQGKSLYHTYCGFRZGNQXCLPDLBZCSCZQLLJBLHBZCYPZZPPDYMZZSGYHCKCPZJGSLJLNSCDSLDL"
                                  @"XBMSTLDDFJMKDJDHZLZXLSZQPQPGJLLYBDSZGQLBZLSLKYYHZTTNTJYQTZZPSZQZTLLJTYYLLQLLQYZQLBDZLSLYYZYMDFSZSNHL"
                                  @"XZNCZQZPBWSKRFBSYZMTHBLGJPMCZZLSTLXSHTCSYZLZBLFEQHLXFLCJLYLJQCBZLZJHHSSTBRMHXZHJZCLXFNBGXGTQJCZTMSFZ"
                                  @"KJMSSNXLJKBHSJXNTNLZDNTLMSJXGZJYJCZXYJYJWRWWQNZTNFJSZPZSHZJFYRDJSFSZJZBJFZQZZHZLXFYSBZQLZSGYFTZDCSZX"
                                  @"ZJBQMSZKJRHYJZCKMJKHCHGTXKXQGLXPXFXTRTYLXJXHDTSJXHJZJXZWZLCQSBTXWXGXTXXHXFTSDKFJHZYJFJXRZSDLLLTQSQQZ"
                                  @"QWZXSYQTWGWBZCGZLLYZBCLMQQTZHZXZXLJFRMYZFLXYSQXXJKXRMQDZDMMYYBSQBHGZMWFWXGMXLZPYYTGZYCCDXYZXYWGSYJYZ"
                                  @"NBHPZJSQSYXSXRTFYZGRHZTXSZZTHCBFCLSYXZLZQMZLMPLMXZJXSFLBYZMYQHXJSXRXSQZZZSSLYFRCZJRCRXHHZXQYDYHXSJJH"
                                  @"ZCXZBTYNSYSXJBQLPXZQPYMLXZKYXLXCJLCYSXXZZLXDLLLJJYHZXGYJWKJRWYHCPSGNRZLFZWFZZNSXGXFLZSXZZZBFCSYJDBRJ"
                                  @"KRDHHGXJLJJTGXJXXSTJTJXLYXQFCSGSWMSBCTLQZZWLZZKXJMLTMJYHSDDBXGZHDLBMYJFRZFSGCLYJBPMLYSMSXLSZJQQHJZFX"
                                  @"GFQFQBPXZGYYQXGZTCQWYLTLGWSGWHRLFSFGZJMGMGBGTJFSYZZGZYZAFLSSPMLPFLCWBJZCLJJMZLPJJLYMQDMYYYFBGYGYZMLY"
                                  @"ZDXQYXRQQQHSYYYQXYLJTYXFSFSLLGNQCYHYCWFHCCCFXPYLYPLLZYXXXXXKQHHXSHJZCFZSCZJXCPZWHHHHHAPYLQALPQAFYHXD"
                                  @"YLUKMZQGGGDDESRNNZLTZGCHYPPYSQJJHCLLJTOLNJPZLJLHYMHEYDYDSQYCDDHGZUNDZCLZYZLLZNTNYZGSLHSLPJJBDGWXPCDU"
                                  @"TJCKLKCLWKLLCASSTKZZDNQNTTLYYZSSYSSZZRYLJQKCQDHHCRXRZYDGRGCWCGZQFFFPPJFZYNAKRGYWYQPQXXFKJTSZZXSWZDDF"
                                  @"BBXTBGTZKZNPZZPZXZPJSZBMQHKCYXYLDKLJNYPKYGHGDZJXXEAHPNZKZTZCMXCXMMJXNKSZQNMNLWBWWXJKYHCPSTMCSQTZJYXT"
                                  @"PCTPDTNNPGLLLZSJLSPBLPLQHDTNJNLYYRSZFFJFQWDPHZDWMRZCCLODAXNSSNYZRESTYJWJYJDBCFXNMWTTBYLWSTSZGYBLJPXG"
                                  @"LBOCLHPCBJLTMXZLJYLZXCLTPNCLCKXTPZJSWCYXSFYSZDKNTLBYJCYJLLSTGQCBXRYZXBXKLYLHZLQZLNZCXWJZLJZJNCJHXMNZ"
                                  @"ZGJZZXTZJXYCYYCXXJYYXJJXSSSJSTSSTTPPGQTCSXWZDCSYFPTFBFHFBBLZJCLZZDBXGCXLQPXKFZFLSYLTUWBMQJHSZBMDDBCY"
                                  @"SCCLDXYCDDQLYJJWMQLLCSGLJJSYFPYYCCYLTJANTJJPWYCMMGQYYSXDXQMZHSZXPFTWWZQSWQRFKJLZJQQYFBRXJHHFWJJZYQAZ"
                                  @"MYFRHCYYBYQWLPEXCCZSTYRLTTDMQLYKMBBGMYYJPRKZNPBSXYXBHYZDJDNGHPMFSGMWFZMFQMMBCMZZCJJLCNUXYQLMLRYGQZCY"
                                  @"XZLWJGCJCGGMCJNFYZZJHYCPRRCMTZQZXHFQGTJXCCJEAQCRJYHPLQLSZDJRBCQHQDYRHYLYXJSYMHZYDWLDFRYHBPYDTSSCNWBX"
                                  @"GLPZMLZZTQSSCPJMXXYCSJYTYCGHYCJWYRXXLFEMWJNMKLLSWTXHYYYNCMMCWJDQDJZGLLJWJRKHPZGGFLCCSCZMCBLTBHBQJXQD"
                                  @"SPDJZZGKGLFQYWBZYZJLTSTDHQHCTCBCHFLQMPWDSHYYTQWCNZZJTLBYMBPDYYYXSQKXWYYFLXXNCWCXYPMAELYKKJMZZZBRXYYQ"
                                  @"JFLJPFHHHYTZZXSGQQMHSPGDZQWBWPJHZJDYSCQWZKTXXSQLZYYMYSDZGRXCKKUJLWPYSYSCSYZLRMLQSYLJXBCXTLWDQZPCYCYK"
                                  @"PPPNSXFYZJJRCEMHSZMSXLXGLRWGCSTLRSXBZGBZGZTCPLUJLSLYLYMTXMTZPALZXPXJTJWTCYYZLBLXBZLQMYLXPGHDSLSSDMXM"
                                  @"BDZZSXWHAMLCZCPJMCNHJYSNSYGCHSKQMZZQDLLKABLWJXSFMOCDXJRRLYQZKJMYBYQLYHETFJZFRFKSRYXFJTWDSXXSYSQJYSLY"
                                  @"XWJHSNLXYYXHBHAWHHJZXWMYLJCSSLKYDZTXBZSYFDXGXZJKHSXXYBSSXDPYNZWRPTQZCZENYGCXQFJYKJBZMLJCMQQXUOXSLYXX"
                                  @"LYLLJDZBTYMHPFSTTQQWLHOKYBLZZALZXQLHZWRRQHLSTMYPYXJJXMQSJFNBXYXYJXXYQYLTHYLQYFMLKLJTMLLHSZWKZHLJMLHL"
                                  @"JKLJSTLQXYLMBHHLNLZXQJHXCFXXLHYHJJGBYZZKBXSCQDJQDSUJZYYHZHHMGSXCSYMXFEBCQWWRBPYYJQTYZCYQYQQZYHMWFFHG"
                                  @"ZFRJFCDPXNTQYZPDYKHJLFRZXPPXZDBBGZQSTLGDGYLCQMLCHHMFYWLZYXKJLYPQHSYWMQQGQZMLZJNSQXJQSYJYCBEHSXFSZPXZ"
                                  @"WFLLBCYYJDYTDTHWZSFJMQQYJLMQXXLLDTTKHHYBFPWTYYSQQWNQWLGWDEBZWCMYGCULKJXTMXMYJSXHYBRWFYMWFRXYQMXYSZTZ"
                                  @"ZTFYKMLDHQDXWYYNLCRYJBLPSXCXYWLSPRRJWXHQYPHTYDNXHHMMYWYTZCSQMTSSCCDALWZTCPQPYJLLQZYJSWXMZZMMYLMXCLMX"
                                  @"CZMXMZSQTZPPQQBLPGXQZHFLJJHYTJSRXWZXSCCDLXTYJDCQJXSLQYCLZXLZZXMXQRJMHRHZJBHMFLJLMLCLQNLDXZLLLPYPSYJY"
                                  @"SXCQQDCMQJZZXHNPNXZMEKMXHYKYQLXSXTXJYYHWDCWDZHQYYBGYBCYSCFGPSJNZDYZZJZXRZRQJJYMCANYRJTLDPPYZBSTJKXXZ"
                                  @"YPFDWFGZZRPYMTNGXZQBYXNBUFNQKRJQZMJEGRZGYCLKXZDSKKNSXKCLJSPJYYZLQQJYBZSSQLLLKJXTBKTYLCCDDBLSPPFYLGYD"
                                  @"TZJYQGGKQTTFZXBDKTYYHYBBFYTYYBCLPDYTGDHRYRNJSPTCSNYJQHKLLLZSLYDXXWBCJQSPXBPJZJCJDZFFXXBRMLAZHCSNDLBJ"
                                  @"DSZBLPRZTSWSBXBCLLXXLZDJZSJPYLYXXYFTFFFBHJJXGBYXJPMMMPSSJZJMTLYZJXSWXTYLEDQPJMYGQZJGDJLQJWJQLLSJGJGY"
                                  @"GMSCLJJXDTYGJQJQJCJZCJGDZZSXQGSJGGCXHQXSNQLZZBXHSGZXCXYLJXYXYYDFQQJHJFXDHCTXJYRXYSQTJXYEFYYSSYYJXNCY"
                                  @"ZXFXMSYSZXYYSCHSHXZZZGZZZGFJDLTYLNPZGYJYZYYQZPBXQBDZTZCZYXXYHHSQXSHDHGQHJHGYWSZTMZMLHYXGEBTYLZKQWYTJ"
                                  @"ZRCLEKYSTDBCYKQQSAYXCJXWWGSBHJYZYDHCSJKQCXSWXFLTYNYZPZCCZJQTZWJQDZZZQZLJJXLSBHPYXXPSXSHHEZTXFPTLQYZZ"
                                  @"XHYTXNCFZYYHXGNXMYWXTZSJPTHHGYMXMXQZXTSBCZYJYXXTYYZYPCQLMMSZMJZZLLZXGXZAAJZYXJMZXWDXZSXZDZXLEYJJZQBH"
                                  @"ZWZZZQTZPSXZTDSXJJJZNYAZPHXYYSRNQDTHZHYYKYJHDZXZLSWCLYBZYECWCYCRYLCXNHZYDZYDYJDFRJJHTRSQTXYXJRJHOJYN"
                                  @"XELXSFSFJZGHPZSXZSZDZCQZBYYKLSGSJHCZSHDGQGXYZGXCHXZJWYQWGYHKSSEQZZNDZFKWYSSTCLZSTSYMCDHJXXYWEYXCZAYD"
                                  @"MPXMDSXYBSQMJMZJMTZQLPJYQZCGQHXJHHLXXHLHDLDJQCLDWBSXFZZYYSCHTYTYYBHECXHYKGJPXHHYZJFXHWHBDZFYZBCAPNPG"
                                  @"NYDMSXHMMMMAMYNBYJTMPXYYMCTHJBZYFCGTYHWPHFTWZZEZSBZEGPFMTSKFTYCMHFLLHGPZJXZJGZJYXZSBBQSCZZLZCCSTPGXM"
                                  @"JSFTCCZJZDJXCYBZLFCJSYZFGSZLYBCWZZBYZDZYPSWYJZXZBDSYUXLZZBZFYGCZXBZHZFTPBGZGEJBSTGKDMFHYZZJHZLLZZGJQ"
                                  @"ZLSFDJSSCBZGPDLFZFZSZYZYZSYGCXSNXXCHCZXTZZLJFZGQSQYXZJQDCCZTQCDXZJYQJQCHXZTDLGSCXZSYQJQTZWLQDQZTQCHQ"
                                  @"QJZYEZZZPBWKDJFCJPZTYPQYQTTYNLMBDKTJZPQZQZZFPZSBNJLGYJDXJDZZKZGQKXDLPZJTCJDQBXDJQJSTCKNXBXZMSLYJCQMT"
                                  @"JQWWCJQNJNLLLHJCWQTBZQYDZCZPZZDZYDDCYZZZCCJTTJFZDPRRTZTJDCQTQZDTJNPLZBCLLCTZSXKJZQZPZLBZRBTJDCXFCZDB"
                                  @"CCJJLTQQPLDCGZDBBZJCQDCJWYNLLZYZCCDWLLXWZLXRXNTQQCZXKQLSGDFQTDDGLRLAJJTKUYMKQLLTZYTDYYCZGJWYXDXFRSKS"
                                  @"TQTENQMRKQZHHQKDLDAZFKYPBGGPZREBZZYKZZSPEGJXGYKQZZZSLYSYYYZWFQZYLZZLZHWCHKYPQGNPGBLPLRRJYXCCSYYHSFZF"
                                  @"YBZYYTGZXYLXCZWXXZJZBLFFLGSKHYJZEYJHLPLLLLCZGXDRZELRHGKLZZYHZLYQSZZJZQLJZFLNBHGWLCZCFJYSPYXZLZLXGCCP"
                                  @"ZBLLCYBBBBUBBCBPCRNNZCZYRBFSRLDCGQYYQXYGMQZWTZYTYJXYFWTEHZZJYWLCCNTZYJJZDEDPZDZTSYQJHDYMBJNYJZLXTSST"
                                  @"PHNDJXXBYXQTZQDDTJTDYYTGWSCSZQFLSHLGLBCZPHDLYZJYCKWTYTYLBNYTSDSYCCTYSZYYEBHEXHQDTWNYGYCLXTSZYSTQMYGZ"
                                  @"AZCCSZZDSLZCLZRQXYYELJSBYMXSXZTEMBBLLYYLLYTDQYSHYMRQWKFKBFXNXSBYCHXBWJYHTQBPBSBWDZYLKGZSKYHXQZJXHXJX"
                                  @"GNLJKZLYYCDXLFYFGHLJGJYBXQLYBXQPQGZTZPLNCYPXDJYQYDYMRBESJYYHKXXSTMXRCZZYWXYQYBMCLLYZHQYZWQXDBXBZWZMS"
                                  @"LPDMYSKFMZKLZCYQYCZLQXFZZYDQZPZYGYJYZMZXDZFYFYTTQTZHGSPCZMLCCYTZXJCYTJMKSLPZHYSNZLLYTPZCTZZCKTXDHXXT"
                                  @"QCYFKSMQCCYYAZHTJPCYLZLYJBJXTPNYLJYYNRXSYLMMNXJSMYBCSYSYLZYLXJJQYLDZLPQBFZZBLFNDXQKCZFYWHGQMRDSXYCYT"
                                  @"XNQQJZYYPFZXDYZFPRXEJDGYQBXRCNFYYQPGHYJDYZXGRHTKYLNWDZNTSMPKLBTHBPYSZBZTJZSZZJTYYXZPHSSZZBZCZPTQFZMY"
                                  @"FLYPYBBJQXZMXXDJMTSYSKKBJZXHJCKLPSMKYJZCXTMLJYXRZZQSLXXQPYZXMKYXXXJCLJPRMYYGADYSKQLSNDHYZKQXZYZTCGHZ"
                                  @"TLMLWZYBWSYCTBHJHJFCWZTXWYTKZLXQSHLYJZJXTMPLPYCGLTBZZTLZJCYJGDTCLKLPLLQPJMZPAPXYZLKKTKDZCZZBNZDYDYQZ"
                                  @"JYJGMCTXLTGXSZLMLHBGLKFWNWZHDXUHLFMKYSLGXDTWWFRJEJZTZHYDXYKSHWFZCQSHKTMQQHTZHYMJDJSKHXZJZBZZXYMPAGQM"
                                  @"STPXLSKLZYNWRTSQLSZBPSPSGZWYHTLKSSSWHZZLYYTNXJGMJSZSUFWNLSOZTXGXLSAMMLBWLDSZYLAKQCQCTMYCFJBSLXCLZZCL"
                                  @"XXKSBZQCLHJPSQPLSXXCKSLNHPSFQQYTXYJZLQLDXZQJZDYYDJNZPTUZDSKJFSLJHYLZSQZLBTXYDGTQFDBYAZXDZHZJNHHQBYKN"
                                  @"XJJQCZMLLJZKSPLDYCLBBLXKLELXJLBQYCXJXGCNLCQPLZLZYJTZLJGYZDZPLTQCSXFDMNYCXGBTJDCZNBGBQYQJWGKFHTNPYQZQ"
                                  @"GBKPBBYZMTJDYTBLSQMPSXTBNPDXKLEMYYCJYNZCTLDYKZZXDDXHQSHDGMZSJYCCTAYRZLPYLTLKXSLZCGGEXCLFXLKJRTLQJAQZ"
                                  @"NCMBYDKKCXGLCZJZXJHPTDJJMZQYKQSECQZDSHHADMLZFMMZBGNTJNNLGBYJBRBTMLBYJDZXLCJLPLDLPCQDHLXZLYCBLCXZZJAD"
                                  @"JLNZMMSSSMYBHBSQKBHRSXXJMXSDZNZPXLGBRHWGGFCXGMSKLLTSJYYCQLTSKYWYYHYWXBXQYWPYWYKQLSQPTNTKHQCWDQKTWPXX"
                                  @"HCPTHTWUMSSYHBWCRWXHJMKMZNGWTMLKFGHKJYLSYYCXWHYECLQHKQHTTQKHFZLDXQWYZYYDESBPKYRZPJFYYZJCEQDZZDLATZBB"
                                  @"FJLLCXDLMJSSXEGYGSJQXCWBXSSZPDYZCXDNYXPPZYDLYJCZPLTXLSXYZYRXCYYYDYLWWNZSAHJSYQYHGYWWAXTJZDAXYSRLTDPS"
                                  @"SYYFNEJDXYZHLXLLLZQZSJNYQYQQXYJGHZGZCYJCHZLYCDSHWSHJZYJXCLLNXZJJYYXNFXMWFPYLCYLLABWDDHWDXJMCXZTZPMLQ"
                                  @"ZHSFHZYNZTLLDYWLSLXHYMMYLMBWWKYXYADTXYLLDJPYBPWUXJMWMLLSAFDLLYFLBHHHBQQLTZJCQJLDJTFFKMMMBYTHYGDCQRDD"
                                  @"WRQJXNBYSNWZDBYYTBJHPYBYTTJXAAHGQDQTMYSTQXKBTZPKJLZRBEQQSSMJJBDJOTGTBXPGBKTLHQXJJJCTHXQDWJLWRFWQGWSH"
                                  @"CKRYSWGFTGYGBXSDWDWRFHWYTJJXXXJYZYSLPYYYPAYXHYDQKXSHXYXGSKQHYWFDDDPPLCJLQQEEWXKSYYKDYPLTJTHKJLTCYYHH"
                                  @"JTTPLTZZCDLTHQKZXQYSTEEYWYYZYXXYYSTTJKLLPZMCYHQGXYHSRMBXPLLNQYDQHXSXXWGDQBSHYLLPJJJTHYJKYPPTHYYKTYEZ"
                                  @"YENMDSHLCRPQFDGFXZPSFTLJXXJBSWYYSKSFLXLPPLBBBLBSFXFYZBSJSSYLPBBFFFFSSCJDSTZSXZRYYSYFFSYZYZBJTBCTSBSD"
                                  @"HRTJJBYTCXYJEYLXCBNEBJDSYXYKGSJZBXBYTFZWGENYHHTHZHHXFWGCSTBGXKLSXYWMTMBYXJSTZSCDYQRCYTWXZFHMYMCXLZNS"
                                  @"DJTTTXRYCFYJSBSDYERXJLJXBBDEYNJGHXGCKGSCYMBLXJMSZNSKGXFBNBPTHFJAAFXYXFPXMYPQDTZCXZZPXRSYWZDLYBBKTYQP"
                                  @"QJPZYPZJZNJPZJLZZFYSBTTSLMPTZRTDXQSJEHBZYLZDHLJSQMLHTXTJECXSLZZSPKTLZKQQYFSYGYWPCPQFHQHYTQXZKRSGTTSQ"
                                  @"CZLPTXCDYYZXSQZSLXLZMYCPCQBZYXHBSXLZDLTCDXTYLZJYYZPZYZLTXJSJXHLPMYTXCQRBLZSSFJZZTNJYTXMYJHLHPPLCYXQJ"
                                  @"QQKZZSCPZKSWALQSBLCCZJSXGWWWYGYKTJBBZTDKHXHKGTGPBKQYSLPXPJCKBMLLXDZSTBKLGGQKQLSBKKTFXRMDKBFTPZFRTBBR"
                                  @"FERQGXYJPZSSTLBZTPSZQZSJDHLJQLZBPMSMMSXLQQNHKNBLRDDNXXDHDDJCYYGYLXGZLXSYGMQQGKHBPMXYXLYTQWLWGCPBMQXC"
                                  @"YZYDRJBHTDJYHQSHTMJSBYPLWHLZFFNYPMHXXHPLTBQPFBJWQDBYGPNZTPFZJGSDDTQSHZEAWZZYLLTYYBWJKXXGHLFKXDJTMSZS"
                                  @"QYNZGGSWQSPHTLSSKMCLZXYSZQZXNCJDQGZDLFNYKLJCJLLZLMZZNHYDSSHTHZZLZZBBHQZWWYCRZHLYQQJBEYFXXXWHSRXWQHWP"
                                  @"SLMSSKZTTYGYQQWRSLALHMJTQJSMXQBJJZJXZYZKXBYQXBJXSHZTSFJLXMXZXFGHKZSZGGYLCLSARJYHSLLLMZXELGLXYDJYTLFB"
                                  @"HBPNLYZFBBHPTGJKWETZHKJJXZXXGLLJLSTGSHJJYQLQZFKCGNNDJSSZFDBCTWWSEQFHQJBSAQTGYPQLBXBMMYWXGSLZHGLZGQYF"
                                  @"LZBYFZJFRYSFMBYZHQGFWZSYFYJJPHZBYYZFFWODGRLMFTWLBZGYCQXCDJYGZYYYYTYTYDWEGAZYHXJLZYYHLRMGRXXZCLHNELJJ"
                                  @"TJTPWJYBJJBXJJTJTEEKHWSLJPLPSFYZPQQBDLQJJTYYQLYZKDKSQJYYQZLDQTGJQYZJSUCMRYQTHTEJMFCTYHYPKMHYZWJDQFHY"
                                  @"YXWSHCTXRLJHQXHCCYYYJLTKTTYTMXGTCJTZAYYOCZLYLBSZYWJYTSJYHBYSHFJLYGJXXTMZYYLTXXYPZLXYJZYZYYPNHMYMDYYL"
                                  @"BLHLSYYQQLLNJJYMSOYQBZGDLYXYLCQYXTSZEGXHZGLHWBLJHEYXTWQMAKBPQCGYSHHEGQCMWYYWLJYJHYYZLLJJYLHZYHMGSLJL"
                                  @"JXCJJYCLYCJPCPZJZJMMYLCQLNQLJQJSXYJMLSZLJQLYCMMHCFMMFPQQMFYLQMCFFQMMMMHMZNFHHJGTTHHKHSLNCHHYQDXTMMQD"
                                  @"CYZYXYQMYQYLTDCYYYZAZZCYMZYDLZFFFMMYCQZWZZMABTBYZTDMNZZGGDFTYPCGQYTTSSFFWFDTZQSSYSTWXJHXYTSXXYLBYQHW"
                                  @"WKXHZXWZNNZZJZJJQJCCCHYYXBZXZCYZTLLCQXYNJYCYYCYNZZQYYYEWYCZDCJYCCHYJLBTZYYCQWMPWPYMLGKDLDLGKQQBGYCHJ"
                                  @"XY";
+ (NSString*)getChineseSpell:(NSString*) Chinese {
	if(Chinese.length == 0) {
		return @"";
	}

	NSString* Spelling = @"";
	const unsigned short* bsConvert;

	unsigned short location;
	for (int i = 0; i < Chinese.length; ++i) {
		bsConvert = (unsigned short*)[[Chinese substringFromIndex:i] cStringUsingEncoding:NSUnicodeStringEncoding];
		location = *bsConvert;
		if((location>='a'&&location<='z')||(location>='A'&&location<='Z')) {
			Spelling = [Spelling stringByAppendingFormat:@"%c", location];
			continue;
		}
		if(location < 256) {
			Spelling = [Spelling stringByAppendingFormat:@"%c", location];
			continue;
		}
		if(location>=19968&&location<=40869) {
			Spelling = [Spelling stringByAppendingFormat:@"%c", [ChineseFirstPY characterAtIndex:location-19968]];
			continue;
		}
	}
	return Spelling;
}

+ (UIActionSheet*)actionSheet:(NSMutableArray*)buttons 
					  withTag:(int)tag 
				 withDelegate:delegate
					withTitle:title {
	//导航bar上面的操作按钮弹出菜单
	if ([buttons count] > 1) {
		UIActionSheet *menu = [[UIActionSheet alloc] 
							   initWithTitle:title 
							   delegate:delegate 
							   cancelButtonTitle:nil 
							   destructiveButtonTitle:nil 
							   otherButtonTitles:nil];
		menu.tag = tag;
		for(NSMutableDictionary *button in buttons) {
			[menu addButtonWithTitle:[button objectForKey:@"lbl"]];
		}
		[menu addButtonWithTitle:@"取消"];
		menu.cancelButtonIndex = [buttons count];
		
		return [menu autorelease];
	}
	
	return nil;
}

@end
